class RestModelsController < ApplicationController
  # GET /rest_models
  # GET /rest_models.xml
  def index
    @rest_models = RestModel.find(:all)

    respond_to do |format|
      format.html # index.rhtml
      format.xml  { render :xml => @rest_models.to_xml }
    end
  end

  # GET /rest_models/1
  # GET /rest_models/1.xml
  def show
    @rest_model = RestModel.find(params[:id])

    respond_to do |format|
      format.html # show.rhtml
      format.xml  { render :xml => @rest_model.to_xml }
    end
  end

  # GET /rest_models/new
  def new
    @rest_model = RestModel.new
  end

  # GET /rest_models/1;edit
  def edit
    @rest_model = RestModel.find(params[:id])
  end

  # POST /rest_models
  # POST /rest_models.xml
  def create
    @rest_model = RestModel.new(params[:rest_model])

    respond_to do |format|
      if @rest_model.save
        flash[:notice] = 'RestModel was successfully created.'
        format.html { redirect_to rest_model_url(@rest_model) }
        format.xml  { head :created, :location => rest_model_url(@rest_model) }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @rest_model.errors.to_xml }
      end
    end
  end

  # PUT /rest_models/1
  # PUT /rest_models/1.xml
  def update
    @rest_model = RestModel.find(params[:id])

    respond_to do |format|
      if @rest_model.update_attributes(params[:rest_model])
        flash[:notice] = 'RestModel was successfully updated.'
        format.html { redirect_to rest_model_url(@rest_model) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @rest_model.errors.to_xml }
      end
    end
  end

  # DELETE /rest_models/1
  # DELETE /rest_models/1.xml
  def destroy
    @rest_model = RestModel.find(params[:id])
    @rest_model.destroy

    respond_to do |format|
      format.html { redirect_to rest_models_url }
      format.xml  { head :ok }
    end
  end
end
